//
//  @ Project : Project1
//  @ File Name : Treasure.java
//  @ Date : 1/21/2013
//  @ Author : Graham Tapscott
//
//



/**
 * Treasure - a class representing a treasure item
 * @author gtapscott
 *
 */
public class Treasure extends Item {
	private Double weight = 0.0;
	private Double value = 0.0;
	

	/***
	 * Treasure - no-arg constructor
	 */
	public Treasure() {
	}
	
	/**
	 * Treasure - argumented constructor, this can be used to instantiate a new object from a 
	 * string representation of the object
	 * @param input a string representation of the object
	 */
	public Treasure(String[] input) {
		deSerialize(input);
	}
	


	public String toString(){
		return serialize();
	}
	public void deSerialize(String[] item) {
		this.index = Integer.parseInt(item[1].trim());
		this.type = item[2].trim();
		this.creatureIndex = Integer.parseInt(item[3].trim());
		this.weight = Double.parseDouble(item[4].trim());
		this.value = Double.parseDouble(item[5].trim());
	}
	
	public String serialize(){
		return ("i:" + this.index + ":" + this.type + ":" + this.creatureIndex + ":" + this.weight + ":" 
				+ this.value);		
	}
}
